import javax.swing.plaf.PanelUI;
import javax.swing.plaf.synth.SynthOptionPaneUI;
class   Money implements Cloneable{
    public double m =19.9;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Person implements Cloneable{//空接口，
    public String  name;
    public  int  age;
    public Money money= new Money();
    public  Person(String name,int age){
        this.age=  age;
        this.name= name;

    }

    @Override
    public String  toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person temp = (Person) super.clone();
        temp.money = (Money) this.money.clone();
        return temp;

    }
}

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException  {
        Person person =new Person("张三",10);
        Person person1= (Person) person.clone(); //clon方法,

        System.out.println(person.money.m);
        System.out.println(person1.money.m );


        System.out.println("=============");
        person.money.m=99.9;
        System.out.println(person.money.m );
        System.out.println(person1.money.m);
    }






    public static void main1(String[] args) throws CloneNotSupportedException  {
        Person person =new Person("张三",10);
        Person person1= (Person) person.clone(); //clon方法,

        System.out.println(person);

        System.out.println(person1);
    }

}
